﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EventConsoleApplication1
{
    public class OrderService
    {
        public event EventHandler<OrderEventArgs> OrderCreated;

        protected virtual void OnOrderCreated(string orderNo)
        {
            if (this.OrderCreated != null)
            {
                this.OrderCreated(this, new OrderEventArgs(orderNo));
            }
        }

        public void CreateOrder()
        {
            string orderNo = "XS" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
            Console.WriteLine("订单创建成功{0}", orderNo);
            this.OnOrderCreated(orderNo);
        }
    }
}
